<?php
namespace app\branch\controller;

use think\Controller;
use think\Request;
use think\Session;
use think\Db;

class Card extends Controller
{
	use \app\common\traits\controller\TraitController;
	protected $beforeActionList = [
        'checkLogin',
    ];
    protected function checkLogin()
    {
        if (!model('Managers')->checkLogin()) {
            $this->redirect('@manager/login');
            exit;
        }
    }
	/**
	 * [getList 卡管理]
	 * @return [type] [description]
	 */
	public function getList()
	{
		//去本公司下的营地
      	$lo_bran_id = model('Managers')->getLoginUserInfo('branch_id');
      	$campid = model('Campcontrols')->where('branch_id',$lo_bran_id)->column('id');
      	$query = ['camp_id'=>['in',$campid]];
      	$list = model('Cards')->getCardLists(array_merge(input('get.'),$query));
		$this->assign('list',$list);
		return view('card/index');
	}

	public function getCardInfo($id)
	{
		$card_info = model('Cards')->getCardInfo($id);//halt($card_info);
		$this->assign('card_info',$card_info);
		return view('card/card');
	}

}